<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 杨辉三角 -->
    <script>
      var generate = function (numRows) {
        var a = []
        for (var i = 0; i < numRows; i++) {
          var b = new Array(i + 1).fill(1)
          for (var c = 1; c < b.length - 1; c++) {
            b[c] = a[i - 1][c - 1] + a[i - 1][c]
          }
          a.push(b)
        }
        return a
      }
      console.log(generate(5))
    </script>
  </body>
</html>
